<?php
namespace App\Model;

use App\Model\BaseModel;

/**
 * 取回报价详情相关
 * OutTradeDetailModel.php
 * @author zhouqiang
 * @date 2018/05/11
 */
class OutTradeDetailModel extends BaseModel 
{
	protected $table = 'out_trade_detail';
    protected $primaryKey = 'id';

    public static function createTradeDetail($tradeId,$details){
        $model = new self ();
        $items = [];
        foreach ( $details as $item ) {
            $items[] = [
                'out_trade_id' =>$tradeId,
                'o_id' => $item['o_id'],
                'app_id' => $item['app_id'],
//                'class_id' => $item ['class_id'],
//                'instance_id' => $item ['instance_id'],
//                'market_hash_name' => $item ['market_hash_name'],
//                'market_name' => $item ['market_name'],
            ];
        }
        $result = $model->insert($items);
        if (!$result) {
            return false;
        }
        return true;

    }
}